package com.zx.task.manager.param;

import com.zx.validation.annotation.ParameterValidation;
import com.zx.validation.enums.ValidateRulesEnum;
import com.zx.validation.groups.Query;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * <p>
 * description: 任务操作记录参数 <br>
 * create: 2025-10-13 20:15
 * </p>
 *
 * @author zhou  xun
 */
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class TaskOperationsParam implements Serializable, Query {
    /**
     * 记录ID
     */
    private String id;

    /**
     * 任务ID
     */
    private String taskId;

    /**
     * 操作类型：1-创建 2-编辑 3-发布 4-签收 5-进度更新 6-完成 7-关闭 8-取消 9-转派
     */
    private Integer operationType;

    /**
     * 操作人ID
     */
    private String operatorId;

    /**
     * 操作人姓名
     */
    private String operatorName;

    /**
     * 进度百分比(0-100)
     */
    @ParameterValidation(index = 0, desc = "进度百分比", rules = {ValidateRulesEnum.NUMBER_MIN, ValidateRulesEnum.NUMBER_MAX}, numberMin = 0, numberMax = 100)
    private Integer progressPercent;

    /**
     * 操作备注/反馈内容
     */
    private String remark;

    /**
     * 附件路径
     */
    private String attachment;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 创建时间开始
     * 用于时间范围查询，当只提供开始时间时，查询大于等于该时间的记录
     */
    private LocalDateTime createTimeStart;

    /**
     * 创建时间结束
     * 用于时间范围查询，当只提供结束时间时，查询小于等于该时间的记录
     */
    private LocalDateTime createTimeEnd;

    /**
     * 当前页码
     */
    @ParameterValidation(index = 0, desc = "当前页码", rules = {ValidateRulesEnum.NUMBER_MIN}, numberMin = 1)
    private Long pageNum;

    /**
     * 每页条数
     */
    @ParameterValidation(index = 0, desc = "每页条数", rules = {ValidateRulesEnum.NUMBER_MIN, ValidateRulesEnum.NUMBER_MAX}, numberMin = 1, numberMax = 1000)
    private Long pageSize;

    @Override
    public Set<String> getQueryGroupFields() {
        return Set.of("taskId", "operationType", "operatorId", "createTimeStart", "createTimeEnd",
                "pageNum", "pageSize");
    }
}